﻿Imports System.Text.RegularExpressions

Namespace Attributes
    Public Class PropertiesAttributes

        Private _labelAtt As LabelAttribute
        Public Property LabelAtt() As LabelAttribute
            Get
                If _labelAtt Is Nothing Then
                    _labelAtt = New LabelAttribute(Me.PropertyName)
                    _labelAtt.Text = Regex.Replace(_labelAtt.Text, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ") '"([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ")
                End If
                Return _labelAtt
            End Get
            Set(ByVal value As LabelAttribute)
                _labelAtt = value
            End Set
        End Property

        Private _RequiredField As RequiredFieldAttribute
        Public Property RequiredField() As RequiredFieldAttribute
            Get
                Return _RequiredField
            End Get
            Set(ByVal value As RequiredFieldAttribute)
                _RequiredField = value
            End Set
        End Property

        Private _PropertyType As Type
        Public Property PropertyType() As Type
            Get
                Return _PropertyType
            End Get
            Set(ByVal value As Type)
                _PropertyType = value
            End Set
        End Property

        Private _isListViewPart As isListViewPartAttribute
        Public Property isListViewPart() As isListViewPartAttribute
            Get
                Return _isListViewPart
            End Get
            Set(ByVal value As isListViewPartAttribute)
                _isListViewPart = value
            End Set
        End Property


        Private _PropertyValue As Object
        Public Property PropertyValue() As Object
            Get
                Return _PropertyValue
            End Get
            Set(ByVal value As Object)
                _PropertyValue = value
            End Set
        End Property

        Private _DescriptionPartAtt As DescriptionPartAttribute
        Public Property DescriptionPartAtt() As DescriptionPartAttribute
            Get
                Return _DescriptionPartAtt
            End Get
            Set(ByVal value As DescriptionPartAttribute)
                _DescriptionPartAtt = value
            End Set
        End Property

        Private _FieldMappingAtt As FieldMappingAttribute
        Public Property FieldMappingAtt() As FieldMappingAttribute
            Get
                Return _FieldMappingAtt
            End Get
            Set(ByVal value As FieldMappingAttribute)
                _FieldMappingAtt = value
            End Set
        End Property

        Private _PrimaryKeyAtt As PrimaryKeyAttribute
        Public Property PrimaryKeyAtt() As PrimaryKeyAttribute
            Get
                Return _PrimaryKeyAtt
            End Get
            Set(ByVal value As PrimaryKeyAttribute)
                _PrimaryKeyAtt = value
            End Set
        End Property


        Public Property DisableElementAtt As DisableElementAttribute


        Private _PropertyName As String
        Public Property PropertyName() As String
            Get
                Return _PropertyName
            End Get
            Set(ByVal value As String)
                _PropertyName = value
            End Set
        End Property

        Private _isCollectionAtt As IsCollectionAttribute
        Public Property isCollectionAtt() As IsCollectionAttribute
            Get
                Return _isCollectionAtt
            End Get
            Set(ByVal value As IsCollectionAttribute)
                _isCollectionAtt = value
            End Set
        End Property

        Private _ForeingClassMapping As ForeingClassMappingAttribute
        Public Property ForeingClassMapping() As ForeingClassMappingAttribute
            Get
                Return _ForeingClassMapping
            End Get
            Set(ByVal value As ForeingClassMappingAttribute)
                _ForeingClassMapping = value
            End Set
        End Property

        Private _ForeingKeyTableMapp As ForeingKeyTableMappAttribute
        Public Property ForeingKeyTableMapp() As ForeingKeyTableMappAttribute
            Get
                Return _ForeingKeyTableMapp
            End Get
            Set(ByVal value As ForeingKeyTableMappAttribute)
                _ForeingKeyTableMapp = value
            End Set
        End Property

        Private _MultiInputForeingClassMapping As MultiInputForeingClassMappingAttribute
        Public Property MultiInputForeingClassMapping() As MultiInputForeingClassMappingAttribute
            Get
                Return _MultiInputForeingClassMapping
            End Get
            Set(ByVal value As MultiInputForeingClassMappingAttribute)
                _MultiInputForeingClassMapping = value
            End Set
        End Property

        Private _UniqueField As UniqueFieldAttribute
        Public Property UniqueField As UniqueFieldAttribute

            Get
                Return _UniqueField
            End Get
            Set(ByVal value As UniqueFieldAttribute)
                _UniqueField = value
            End Set
        End Property

        Public Function Clone() As PropertiesAttributes
            Dim o As New PropertiesAttributes()
            If Me Is Nothing Then
                Return Nothing
            End If
            o = Me.MemberwiseClone()
            Return o
        End Function
    End Class
End Namespace